package com.hehe.library;

import android.app.Application;

import com.hehe.library.activity.UserInfo;
import com.hehe.library.activity.UserInfoEntity;

import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by xiaoz on 2016/6/15.
 */
public class MyApplication extends Application{
    private static UserInfo userInfo;
    @Override
    public void onCreate() {
        super.onCreate();
        RealmConfiguration realmConfig = new RealmConfiguration.Builder(getApplicationContext()).build();
        Realm.setDefaultConfiguration(realmConfig);
    }
    public static UserInfo getUserInfo(){
        if(userInfo == null)
            return new UserInfo();
        return userInfo;
    };

    public static void setUserInfo(UserInfo myuserInfo){
        if(userInfo == null){
            userInfo = new UserInfo();
            userInfo = myuserInfo;
        }
        userInfo = myuserInfo;
    }
}
